<!DOCTYPE html>
<html lang="en">
<head>
    <include file="Public:header2" />
	<title>{:C('web_title')}</title>
    <script type="text/javascript" src="__PUBLIC__/layer/laydate/laydate.js"></script>
</head>
<body class="blackbg">
    <div id="container" class="logbg">
        <div class="log_title">
            <span class="back"><a href="javascript:history.go(-1)"></a></span>
            评论列表
        </div>
        <div style="font-size:16px;text-align:center;color:#ff9900;margin:15px 0;">
            {$data.title}
        </div>
        <div class="logbot" id="button" style="width:96%;">
        <button type="button" class="layout" style="border:none;width: 100%;" onclick="bianhua()">发表评论</button>
        </div>
        <div class="logbot" style="display:none" id="check">
            <form>
            <input type="hidden" name="articleid" id="articleid" value="{$data['id']}">
            <input type="hidden" name="userid" id="userid" value="{$username}">
            <textarea name="comment" id="comment" style="width:96%;height:100px;background:rgba(0,0,0, .5);color:rgba(255,255,255, .5);font-size:14px;line-height:20px;padding:10px 2%;" onblur="if(this.value == '')this.value='发表你的评论';" onclick="if(this.value == '发表你的评论')this.value='';">发表你的评论</textarea>
      <button type="submit" class="layout" onclick="Update1();" style="border:none;width: 100%;">发表</button>
      <button type="button" class="layout" style="border:none;width: 100%;background:rgba(255,255,255, .5)" onclick="bianhua1()">收起</button>
    </form>
    </div>
        <div class="chgbox">
            <ul>
            <empty name="list">
                <li style="padding:20px 10px;font-size:18px;color:#ff9900;font-weight:900;text-align:center;">{$vo.content}
                    <span class="list_time">暂无评论！</span>
                </li>
            <else />
                <volist name="list" id="vo">
                    <li>
                        <div class="chglist_top">
                        时间：{$vo.comtdate|date="Y-m-d H:i:s",###}
                            <span class="state wait">
                            评论人：{$vo.comtuser1}
                            </span>
                        </div>
                        <div class="chglist_top">
                            {$vo.content}
                        </div>
                    </li>
                </volist>
            </empty>
            </ul>
            <div class="pages">{$page}</div>
        </div>
    </div>
<include file="Public:footer" />
<script>
    function bianhua(){
        $("#check").show();
        $("#button").hide();
    }
    function bianhua1(){
        $("#button").show();
        $("#check").hide();
    }
    function Update1(){
        var articleid=$("#articleid").val();
        var comment=$("#comment").val();
        var username=$("#userid").val();
        if(comment==""||comment==null){
          formMsg('comment', 0, '请输入评论');
          return false;
        }

        $.post("{:U('Article/upcomment')}",{comment:comment,articleid:articleid,username:username},function(data){
          if(data.status==1){
            layer.msg(data.info,{icon:1});
            window.location.reload();
          }else{
            layer.msg(data.info,{icon:2});
            if(data.url){
              window.location=data.url;
            }
          }
        },"json");
      }
</script>
</body>
</html>